let arr = [1, 2, 3]

function subsets(nums) {
    const res = [];
    const len = nums.length;
    const subset= [];
    function dfs(index) {
        res.push(subset.slice());//拷贝一份
        for(let i = index; i < len; i++) {
            subset.push(nums[i]);//放进盒子
            dfs(i + 1)
            subset.pop()//拿出盒子
        } 
    }

    dfs(0)

    return res;
}
